using System;

namespace ColladaDotNet.Pipeline.MD3
{
	public class Frame
	{
		public float[] MIN_BOUNDS = new float[3];// 	First corner of the bounding box.
		public float[]  	MAX_BOUNDS = new float[3];// 	Second corner of the bounding box.
		public float[]  	LOCAL_ORIGIN = new float[3];// 	Local origin, usually (0, 0, 0).
		public float RADIUS;// 	Radius of bounding sphere.
		public string NAME;// 	Name of Frame. ASCII character string, NUL-terminated (C-style)
	}
	public class Tag
	{
		private string NAME;// 	Name of Tag object. ASCII character string, NUL-terminated (C-style).

		public float[] ORIGIN;// 	Coordinates of Tag object.

		public float[] AxisX;

		public float[] AxisY;
		public float[] AxisZ;
	}

	public class Shader
	{
		public string NAME;// 	Pathname of shader in the PK3. ASCII character string, NUL-terminated (C-style).

		public int SHADER_INDEX;// 	Shader index number. No idea how this is allocated, but presumably in sequential order of definition.
	}
	public class Triangle
	{
		public int[] INDEXES = new int[3];// 	List of offset values into the list of Vertex objects that constitute the corners of the Triangle object. Vertex numbers are used instead of actual coordinates, as the coordinates are implicit in the Vertex object. The triangles have clockwise winding.	
	}
	public class TexCoord
	{
		public float[] 	ST = new float[2];// 	s and t texture coordinates, normalized to the range [0, 1]. Values outside the range indicate wraparounds/repeats. Unlike UV coordinates, the origin for texture coordinates is located in the upper left corner (similar to the coordinate system used for computer screens) whereas, in UV mapping, it is placed in the lower left corner. As such, the t value must be flipped to correspond with UV coordinates. See also Left-hand coordinates
	}
	public class Vertex
	{
		public short[] COORD = new short[3];// 	x, y, and z coordinates in left-handed 3-space, scaled down by factor 1.0/64. (Multiply by 1.0/64 to obtain original coordinate value.)
		public byte[] 	NORMAL=new byte[2];// 	Zenith and azimuth angles of normal vector. 255 corresponds to 2 pi. See spherical coordinates.
		public double X
		{
			get
			{
				return COORD[0] / 64.0;
			}
		}
		public double Y
		{
			get
			{
				return COORD[1] / 64.0;
			}
		}
		public double Z
		{
			get
			{
				return COORD[2] / 64.0;
			}
		}
		public double nX
		{
			get
			{
				var lat = NORMAL[0] * (2 * Math.PI) / 255.0;
				var lng = NORMAL[1] * (2 * Math.PI) / 255.0;
				return Math.Cos(lat) * Math.Sin(lng);
			}
		}
		public double nY
		{
			get
			{
				var lat = NORMAL[0] * (2 * Math.PI) / 255.0;
				var lng = NORMAL[1] * (2 * Math.PI) / 255.0;
				return Math.Sin(lat) * Math.Sin(lng);
			}
		}
		public double nZ
		{
			get
			{
				var lat = NORMAL[0] * (2 * Math.PI) / 255.0;
				var lng = NORMAL[1] * (2 * Math.PI) / 255.0;
				return Math.Cos(lng);
			}
		}
	}
}